home *** CD-ROM | disk | FTP | other *** search
/ PC go! 1997 May / PC_GO 5:97.iso / share / blob21 / wing / wing.mst < prev    next >
Encoding:
Text File  |  1996-09-11  |  9.0 KB  |  350 lines

  1. '**************************************************************************
  2. '*                       WinG Setup Program
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8.  
  9. ''Dialog ID's
  10. CONST WELCOME       = 100
  11. CONST ASKQUIT       = 200
  12. CONST DESTPATH      = 300
  13. CONST DESTPATH2     = 301
  14. CONST EXITFAILURE   = 400
  15. CONST EXITQUIT      = 600
  16. CONST EXITSUCCESS   = 700
  17. CONST APPHELP       = 900
  18. CONST CHECK         = 2500
  19. CONST BADPATH       = 6400
  20. CONST RESTART       = 1000
  21.  
  22. ''File Types
  23. CONST WING_RUNFILES     = 1
  24. CONST WING_BUILDFILES   = 2
  25.  
  26. ''Bitmap ID
  27. CONST LOGO = 1
  28.  
  29. GLOBAL FILEDIALOG   ''File path dialog ID
  30.  
  31. GLOBAL DEST$        ''Default destination directory.
  32.  
  33. GLOBAL CHECKSTATES$ ''Dialog list symbol names
  34. GLOBAL WINDRIVE$    ''Windows drive letter.
  35.  
  36. GLOBAL TMPDEST$     '' tmpfile destination
  37.  
  38. GLOBAL bInstallDVA%
  39.  
  40. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  41. DECLARE FUNCTION GetRealWindowsSysDir AS STRING
  42. DECLARE SUB UpdateWinG32 (szOrig$) 
  43.  
  44. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  45. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  46. DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  47. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  48. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  49. DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$) 
  50.  
  51. INIT:
  52.     bInstallDVA% = 0
  53.     
  54.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  55.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  56.  
  57.     SetBitmap CUIDLL$, LOGO
  58.     SetTitle "Microsoft WinG Setup"
  59.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  60.     IF szInf$ = "" THEN
  61.     szInf$ = GetSymbolValue("STF_CWDDIR") + "wing.inf"
  62.     END IF
  63.     ReadInfFile szInf$
  64.  
  65. WELCOME:
  66.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  67.     IF sz$ = "CONTINUE" THEN
  68.     UIPop 1
  69.     ELSE
  70.     GOSUB ASKQUIT
  71.     GOTO WELCOME
  72.     END IF
  73.  
  74.  
  75.     CHECKSTATES$ = "CheckItemsIn"
  76.     AddListItem CHECKSTATES$, "ON"
  77.     AddListItem CHECKSTATES$, "OFF"
  78. '    AddListItem CHECKSTATES$, "ON"
  79.  
  80. CHECK:
  81.     sz$ = UIStartDlg(CUIDLL$, CHECK, "FCheckDlgProc", APPHELP, HELPPROC$)
  82.     IF sz$ = "CONTINUE" THEN
  83.     UIPop 1
  84.     ELSE
  85.     GOSUB ASKQUIT
  86.     GOTO CHECK
  87.     END IF
  88.  
  89.     CHECKSTATES$ = "CheckItemsOut"
  90.     IF GetListItem(CHECKSTATES$, WING_RUNFILES) = "ON" THEN
  91.  
  92.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  93.     DEST$ = GetWindowsSysDir
  94.     
  95.     AddSectionFilesToCopyList "runtime", SrcDir$, DEST$
  96.     
  97.     '
  98.     ' only use DVA on Windows 3.x
  99.     '
  100.     IF OnWin3x() = 1 THEN
  101.         AddSectionFilesToCopyList "dva", SrcDir$, DEST$
  102.         IF VflatdPresent() = 0 THEN
  103.         CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite
  104.         bInstallDVA% = 1
  105.         END IF
  106.     END IF
  107.     
  108.     DEST$ = GetRealWindowsSysDir
  109.     
  110.     AddSectionFilesToCopyList "wing32", SrcDir$, DEST$
  111.     Dest1$ = MakePath(DEST$,"wing32.dll")
  112.     Dest2$ = MakePath(DEST$,"wing32.xxx")
  113.     RenameFilePlease Dest1$,Dest2$
  114.     
  115.     CopyFilesInCopyList
  116.     
  117.     UpdateWinG32 GetRealWindowsSysDir()
  118.  
  119.     END IF
  120.  
  121.     IF GetListItem(CHECKSTATES$, WING_BUILDFILES) = "ON" THEN
  122.     GOTO QUIT
  123.     END IF
  124.  
  125. QUIT:
  126.     ON ERROR GOTO ERRQUIT
  127.  
  128.     IF ERR = 0 THEN
  129.     dlg% = EXITSUCCESS
  130.     ELSEIF ERR = STFQUIT THEN
  131.     dlg% = EXITQUIT
  132.     ELSE
  133.     dlg% = EXITFAILURE
  134.     END IF
  135.  
  136. QUITL1:
  137.     if dlg% = EXITSUCCESS AND bInstallDVA% = 1 then
  138.     sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfoDlgProc", APPHELP, HELPPROC$)
  139.     UIPop 1
  140.     IF sz$ = "CONTINUE" THEN
  141.         rc% = RestartWindows
  142.     ENDIF
  143.     endif
  144.  
  145.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  146.     IF sz$ = "REACTIVATE" THEN
  147.     GOTO QUITL1
  148.     END IF
  149.     UIPop 1
  150.     
  151.  
  152.     END
  153.  
  154. ERRQUIT:
  155.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  156.     END
  157.  
  158.  
  159. BADPATH:
  160.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  161.     IF sz$ = "REACTIVATE" THEN
  162.     GOTO BADPATH
  163.     END IF
  164.     UIPop 1
  165.     RETURN
  166.  
  167.  
  168. ASKQUIT:
  169.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  170.  
  171.     IF sz$ = "EXIT" THEN
  172.     UIPopAll
  173.     ERROR STFQUIT
  174.     ELSEIF sz$ = "REACTIVATE" THEN
  175.     GOTO ASKQUIT
  176.     ELSE
  177.     UIPop 1
  178.     END IF
  179.     RETURN
  180.  
  181.  
  182. GETPATH:
  183.     SetSymbolValue "EditTextIn", DEST$
  184.     SetSymbolValue "EditFocus", "END"
  185.  
  186. GETPATHL1:
  187.     sz$ = UIStartDlg(CUIDLL$, FILEDIALOG, "FEditDlgProc", APPHELP, HELPPROC$)
  188.     DEST$ = GetSymbolValue("EditTextOut")
  189.  
  190.     IF sz$ = "CONTINUE" THEN
  191.     IF IsDirWritable(DEST$) = 0 THEN
  192.         GOSUB BADPATH
  193.         GOTO GETPATHL1
  194.     END IF
  195.     UIPop 1
  196.     ELSEIF sz$ = "REACTIVATE" THEN
  197.     GOTO GETPATHL1
  198.     ELSEIF sz$ = "BACK" THEN
  199.     UIPop 1
  200.     GOTO CHECK
  201.     ELSE
  202.     GOSUB ASKQUIT
  203.     GOTO GETPATH
  204.     END IF
  205.  
  206.     RETURN
  207.  
  208. ADDSAMPLEFILESTOLIST:
  209.     SamplePath$ = MakePath(DEST$,"samples")
  210.     CreateDir SamplePath$, cmoNone
  211.  
  212. '       Add doggie example program
  213.  
  214.     sample$ = "doggie"
  215.  
  216.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  217.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  218.  
  219. '       Add cube example program
  220.  
  221.     sample$ = "cube"
  222.  
  223.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  224.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  225.  
  226. '       Add utils example code
  227.  
  228.     sample$ = "utils"
  229.  
  230.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  231.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  232.  
  233. '       Add timewing example program
  234.  
  235.     sample$ = "timewing"
  236.  
  237.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  238.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  239.  
  240. '       Add halftone example program
  241.  
  242.     sample$ = "halftone"
  243.  
  244.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  245.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  246.  
  247. '       Add palanim example program
  248.  
  249.     sample$ = "palanim"
  250.  
  251.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  252.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  253.  
  254. '       Other sample programs go here
  255.  
  256.     RETURN
  257.     
  258. ADDGROUP:
  259.     SamplePath$ = MakePath(DEST$,"samples")
  260.     proggroup$ = "WinG SDK"
  261.     CreateProgmanGroup proggroup$, "", cmoNone
  262.     
  263.     path$ = MakePath( DEST$, "help\wing.hlp" )
  264.     CreateProgmanItem proggroup$, "WinG Help", "winhelp "+path$, "", cmoOverwrite
  265.     
  266.     path$ = MakePath( DEST$, "bin\wingbug.exe" )
  267.     CreateProgmanItem proggroup$, "WinG Bug Reporting Tool", path$, "", cmoOverwrite
  268.     
  269.     path$ = MakePath( SamplePath$,"doggie\doggie.exe")
  270.     CreateProgmanItem proggroup$, "Doggie", path$, "", cmoOverwrite
  271.     
  272.     path$ = MakePath( SamplePath$,"cube\cube.exe")
  273.     CreateProgmanItem proggroup$, "Cube",path$,"", cmoOverwrite
  274.     
  275.     path$ = MakePath( SamplePath$,"timewing\timewing.exe")
  276.     CreateProgmanItem proggroup$, "Time WinG",path$,"", cmoOverwrite
  277.     
  278.     path$ = MakePath( SamplePath$,"halftone\halftone.exe")
  279.     CreateProgmanItem proggroup$, "Halftone",path$,"", cmoOverwrite
  280.     
  281.     path$ = MakePath( SamplePath$,"palanim\palanim.exe")
  282.     CreateProgmanItem proggroup$, "Palette Animation",path$,"", cmoOverwrite
  283.     
  284. '       Other sample programs get added here
  285.     
  286.     RETURN
  287.  
  288. '**
  289. '** Purpose:
  290. '**     Appends a file name to the end of a directory path,
  291. '**     inserting a backslash character as needed.
  292. '** Arguments:
  293. '**     szDir$  - full directory path (with optional ending "\")
  294. '**     szFile$ - filename to append to directory
  295. '** Returns:
  296. '**     Resulting fully qualified path name.
  297. '*************************************************************************
  298. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  299.     IF szDir$ = "" THEN
  300.     MakePath = szFile$
  301.     ELSEIF szFile$ = "" THEN
  302.     MakePath = szDir$
  303.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  304.     MakePath = szDir$ + szFile$
  305.     ELSE
  306.     MakePath = szDir$ + "\" + szFile$
  307.     END IF
  308. END FUNCTION
  309.  
  310.  
  311. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  312.     szBuf$ = string$(260, 32)
  313.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  314.     IF cbBuf% = 0 THEN
  315.     ERROR STFERR
  316.     ELSE
  317.     IF cbBuf% > 259 THEN
  318.         res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  319.         ERROR STFERR
  320.     END IF
  321.     szBuf$ = RTRIM$(szBuf$)
  322.     IF MID$(szBuf$, 1, 1) = "\" THEN
  323.         szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  324.     ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  325.         szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  326.     END IF
  327.     IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  328.         szBuf$ = szBuf$ + "\"
  329.     END IF
  330.     GetRealWindowsSysDir = szBuf$
  331.     END IF
  332.  
  333.     szBuf$ = ""
  334. END FUNCTION
  335.  
  336. SUB UpdateWinG32 (szOrig$) STATIC 
  337.     '
  338.     ' Here we check the version ourselves of wing32.dll, since 
  339.     ' we can't get version checking for Win32 apps from Win16
  340.     '
  341.     FileNew$ = MakePath(szOrig$, "wing32.dll")
  342.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  343.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  344.     RemoveFile FileOrig$, cmoForce
  345.     ELSE
  346.     RemoveFile FileNew$, cmoForce           ' get rid of new file
  347.     RenameFilePlease FileOrig$,FileNew$     ' put back old file
  348.     END IF
  349. END SUB
  350.